﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using WS.EKA.FJYCM.Business;
using WS.EKA.FJYCM.WebUI.UserControls;
using WS.EKA.FJYCM.Business.Model;

namespace WS.EKA.FJYCM.WebUI.UserControls
{
    public partial class SystemEventsOverView : System.Web.UI.UserControl
    {
        public string SystemType
        {
            get;
            set;
        }

        public List<AppSystems> DataSource
        {
            get;
            set;
        }

        public int Order
        {
            get;
            set;
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                lblTitle.Text = lblTitle_l.Text = SystemType;
                InitialData();
            }
        }

        private void InitialData()
        {
            if (DataSource != null)
            {
                rptSystems_1.DataSource = DataSource;
                rptSystems_2.DataSource = DataSource;
                rptSystems_1.DataBind();
                rptSystems_2.DataBind();

                //add details
                foreach (var item in DataSource)
                {
                    SystemEventsDetail sys_detail = (SystemEventsDetail)Page.LoadControl(
                        "usercontrols/SystemEventsDetail.ascx");
                    sys_detail.SysName = item.AppSystemName;
                    phDetails.Controls.Add(sys_detail);
                }

            }
        }
    }
}